#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll short
const int N=4e5;
__int128 a1[N+5],a2[N+5],a3[N+5],a4[N+5],cnt;ll n,x[N+5],y[N+5],in[N+5];
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
 struct no{
 __int128 sum1,sum2,sum3,sum4;
 }tr[N<<2|4];
void inline pup(int x){tr[x].sum1=tr[ls].sum1+tr[rs].sum1,tr[x].sum2=tr[ls].sum2+tr[rs].sum2;
tr[x].sum3=tr[ls].sum3+tr[rs].sum3;tr[x].sum4=tr[ls].sum4+tr[rs].sum4;}
void inline build(int x,int l,int r){
 tr[x].sum1=tr[x].sum2=tr[x].sum3=tr[x].sum4=0;
 if(l==r)return ;
 build(ls,l,mid);
 build(rs,mid+1,r);
}
void inline addd(int x,int k,int l,int r){
  if(l==r){tr[x].sum1=a1[x];tr[x].sum2=a2[x],tr[x].sum4=a4[x],tr[x].sum3=a3[x];return ;}
  if(k<=mid)addd(ls,k,l,mid);
  else addd(rs,k,mid+1,r);
  pup(x);
}
void inline add(int k,ll g1,int g2,int g3,int g4){
  a1[k]=g1,a2[k]=g2,a3[k]=g3,a4[k]=g4;
  addd(1,k,1,n);
 }
unordered_map<ll,int>qp;

int inline ask(){
  ll l=1,r=n;
  while(l<r){
  long long mid=l+r>>1ll;
 // if(ask1(x)>=sum-ask1(cnt-x+1))r=mid;
  //else l=mid+1;
  }
  return 0;
}
signed main(){
freopen("kte.in","r",stdin);
freopen("kte.out","w",stdout);
   ios::sync_with_stdio(false);
   cin.tie(0),cout.tie(0);
   cin>>n;
   for(int i=1;i<=n;i++){cin>>x[i];y[i]=x[i];}
   sort(y+1,y+n+1);
   for(int i=1;i<=n;i++)qp[y[i]]=i;
   for(int i=1;i<=n;i++){
   int wz=qp[x[i]];
   if(in[x[i]]==0)
   add(wz,1,x[i],i*x[i],(n-i+1)*x[i]),in[x[i]]=1,cnt++;
   else add(wz,0,0,0,0),in[x[i]]=0,cnt--;
   cout<<ask()<<"\n";
   }
}
